import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);
import vuexPersist from "vuex-persist";

export default new Vuex.Store({
  state: {
    token: "",
    user: "",
  },
  mutations: {
    setuser(state, obj) {
      state.token = obj.token;
      state.user = obj.user;
    },
    out(state) {
      state.token = "";
      state.user = "";
    },
  },
  actions: {},
  modules: {},
  plugins: [
    new vuexPersist({
      storage: window.localStorage,
    }).plugin,
  ],
});
